<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        .clearfix:after {
            content:""; 
            display: block; 
            clear:both; 
        }

        *{
            margin:0;
            padding:0;
        }

        ul {
            margin: 100px;
        }

        ul li {
            width: 120px;
            height: 35px;
            list-style-type: none;
            /* 一会儿我们需要给box旋转，也需要透视，干脆给li加，里面的子盒子都有透视效果 */
            perspective: 500px;
            float: left;
            margin: 0 5px;
            text-align: center;
            line-height: 35px;
        }

        .box {
            position: relative;
            width: 100%;   
            height: 100%;
            transform-style: preserve-3d;
            transition: all .4s;
        }

        .box:hover {
            transform: rotateX(90deg);
            
        }

        .front,
        .bottom{
            position: absolute;
            left: 0;
            top: 0;;
            width: 100%;
            height: 100%;
        }

        .front {
            background-color: pink;
            z-index: 1;
            transform: translateZ(17.5px);
        }

        .bottom {
            background-color: purple;
            /* 这个x轴一定是负值 */
            /* 我们如果有移动 或者其他样式，必须先写我们的移动 17.5px是移动 */
            transform: translateY(17.5px) rotateX(-90deg);
        }
    </style>
</head>
<body>
    <!-- li 是做导航栏的 -->
    <!-- .box 是翻转的盒子 front是前面盒子 bottom是底下盒子 -->
    <ul>
        <li>
            <div class="box">
                <div class="front">百事可乐</div>
                <div class="bottom">Pepsi</div>
            </div>
        </li>

        <li>
            <div class="box">
                <div class="front">百事可乐</div>
                <div class="bottom">Pepsi</div>
            </div>
        </li>


        <li>
            <div class="box">
                <div class="front">百事可乐</div>
                <div class="bottom">Pepsi</div>
            </div>
        </li>


        <li>
            <div class="box">
                <div class="front">百事可乐</div>
                <div class="bottom">Pepsi</div>
            </div>
        </li>


        <li>
            <div class="box">
                <div class="front">百事可乐</div>
                <div class="bottom">Pepsi</div>
            </div>
        </li>
    </ul>
</body>
</html>